package cn.wuxuan.service.Impl;

import java.util.List;

import cn.gzsxt.po.PageResult;
import cn.wuxuan.dao.UserDao;
import cn.wuxuan.dao.Impl.UserDaoImpl;
import cn.wuxuan.po.QueryObject;
import cn.wuxuan.po.Result;
import cn.wuxuan.po.Task;
import cn.wuxuan.po.TaskTrans;
import cn.wuxuan.po.User;
import cn.wuxuan.service.UserService;

public class UserServiceImpl implements UserService {
	
	UserDao dao = new UserDaoImpl();
	@Override
	public User selectName(String name) {
		return dao.selectName(name);
	}
	@Override
	public Integer verifyUser(User user) {
		return dao.verifyUser(user);
	}
	@Override
	public Integer checkTitle(String title) {
		return dao.checkTitle(title) ;
	}
	@Override
	public Integer addTask(Task task) {
		
		return dao.addTask(task);
	}
	@Override
	public PageResult selectTask(QueryObject qo) {
		Integer pageSize = qo.getPageSize();
		Integer currentPage = qo.getCurrentPage();
//		数据总条数
		String keyWord = qo.getKeyWord();
		Integer count = dao.findTotalCount(qo);
//		数据表
		List<TaskTrans> list = dao.selectTaskTrans(qo);
		
		PageResult result = new PageResult(list, count, pageSize, currentPage);

		return result;
	}
	@Override
	public Integer deleteTask(String title) {
		
		return dao.deleteTask(title);
	}
	@Override
	public Integer changeTask(TaskTrans trans) {
		return dao.changeTask(trans);
	}
	@Override
	public PageResult selectResult(QueryObject qo) {
		Integer pageSize = qo.getPageSize();
		Integer currentPage = qo.getCurrentPage();
//		数据总条数
		String keyWord = qo.getKeyWord();
		Integer count = dao.findTotalCount(qo);
//		数据表
		List<Result> list = dao.selectResult(qo);
		
		PageResult result = new PageResult(list, count, pageSize, currentPage);
		
		return result;
	}
	@Override
	public Integer changeResult(Result result) {
		return dao.changeResult(result);
	}

}
